home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1013 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  900 b 

  1. Path: atglab.bls.com!Alun.Champion
  2. From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Bit Masking
  5. Date: 10 Jan 1996 22:11:01 GMT
  6. Organization: Computer People Inc.
  7. Message-ID: <ALUN.CHAMPION.96Jan10171101@g7240065.bridge.bst.bls.com>
  8. References: <DKz5y4.8En@twisto.eng.hou.compaq.com>
  9. NNTP-Posting-Host: bstfirewall.bst.bls.com
  10. In-reply-to: garyc%cs%contractors@bangate.compaq.com's message of Wed, 10 Jan
  11.     1996 17:06:24 GMT
  12.  
  13. In article <DKz5y4.8En@twisto.eng.hou.compaq.com> garyc%cs%contractors@bangate.compaq.com (Gary Clarke) writes:
  14.  
  15. :   Can someone tell me the elegent way to clear specific bits from a
  16. :   byte, e.g.
  17.  
  18. :   # define BIT_1    1
  19. :   # define BIT_2    2
  20. :   # define BIT_3    4
  21. :   # define BIT_4    8
  22.  
  23. :   Set the bit:    x |= BIT_x
  24.  
  25. :   Clear the bit using BIT_x:    ????
  26.  
  27. Clear the bit:    x &= ~BIT_?;
  28.  
  29. Regards
  30.  
  31.     -A.
  32. -- 
  33. | A.Champion                |
  34.